package com.atguigu.test2;

/**
 * @author 路飞
 * @date 2024/3/28 10:50
 * @description 10、编写一个懒汉式单例设计模式
 */
public class Exer10 {
    private static Exer10 instance;
    private Exer10() {

    }

    public static Exer10 getInstance() {
        if (instance == null) {
            synchronized (Exer10.class) {
                if (instance == null) {
                    instance = new Exer10();
                }
            }
        }
        return instance;
    }
}
